package top.milkbox.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.milkbox.domain.Category;
import top.milkbox.service.CategoryService;
import top.milkbox.utils.R;

import java.util.List;

@RestController
@RequestMapping("/categories")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public R findAllOrderByClassify() {
        List<Category> categoryList = categoryService.findAllOrderByClassify();

        return new R(true, categoryList, "查询成功");
    }
}
